home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
101-125
/
scopedisk113
/
arexx
/
checkboot.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-03-19
|
5KB
|
143 lines
/* This function is one I use in my automatic checking and moving when I
unwarp a new file. All these functions combined allow me to just type
fixdisk (drive) and it will check for a good boot block and modify the
startup-sequence. In essence, it tells if the disk is bootable. If it
doesn't have a startup-sequence, it asks if you want to de-install the disk.
It will also verify that the boot block is a standard 1.2/1.3 boot block,
and if not, gives the opportunity to save the questionable block and install
a 1.2/1.3 boot block. This function also calls another function which
gets the actual name of the disk. It only calls this function if you elect
to save the non-standard bootblock for further study.
/******************* BOOTCK.rexx ********************************/
/* bootck.rexx Checks floppies for viruses & saves a irregualr block */
no_boot = 'No bootblock installed'
real_boot = 'ARP thinks OK bootblock' /* this is arp's msg on OK bootblock */
YES = 1
NO = 0
STARTUP_SEQ = NO
SAVE = 0
BOOT = 1
NOBOOT = 2
WriteProtect = TRUE /* I disk write protect status */
arg vol /* gotta enter a volume name */
vol = upper(vol)
if length(vol) < 4 then do
say " You GOTTA Enter A Disk to check !!"
exit
end
select
when compare(vol,'DF0:') = 0 then call fixit
when compare(vol,'DF1:') = 0 then call fixit
/* if you have df2: and df3: un - comment the below */
/* when compare(vol,'DF2:') = 0 then call fixit */
/* when compare(vol,'DF3:') = 0 then call fixit */
otherwise say 'Drive Name Entry Error'
end
exit
/* CHECK FOR NON STANDARD BOOT BLOCK */
""'install 'vol 'check | execio for 1 var boot_ck'
/* CHECK FOR EXISTANCE OF STARTUP-SEQUENCE */
if exists(vol's/startup-sequence') then STARTUP_SEQ = YES
/* * * * * * * * * * STARTUP-SEQUENCE NOT FOUND ON DISK * * * * * * * * * */
if STARTUP_SEQ == NO then do
if compare(boot_ck,no_boot) == 0 then do /* no boot block */
say 'no startup-sequence,no boot block'
exit
end
if compare(boot_ck,real_boot) ~= 0 then do /* boot non standard */
say 'there is NO startup-sequence BUT'
say 'There is a Non-Standard Boot Block'
call yes_no 'DE-Install 'vol '?'
if result == YES then call install_disk NOBOOT /* DE-INSTALL ? */
else say "Okay but it might Be A Virus !!"
exit
end
else if compare(boot_ck,real_boot) == 0 then do
say 'there is NO startup-sequence BUT'
say 'there is a VALID Boot block' /* DE-INSTALL ? */
call yes_no 'De-Install 'vol '?'
if result == YES then call install_disk NOBOOT
exit
end
end
/* * * * * * * * * * STARTUP-SEQUENCE LOCATED ON DISK * * * * * * * * * */
if STARTUP_SEQ == YES then do
if compare(boot_ck,no_boot) == 0 then do /* no boot block */
say 'there is a startup-sequence on this disk'
say 'but No boot block is installed'
call yes_no 'Install Boot Block on 'vol '?'
if result = YES then call install_disk BOOT
end
else if compare(boot_ck,real_boot) ~= 0 then do /* boot non standard */
say 'there is a startup-sequence BUT'
say 'Boot Block is non-standard '
call yes_no 'Install standard Boot Block on 'vol '?'
if result = YES then call install_disk SAVE /* save non std ? */
else say "Ok but it might be a VIRUS .."
end
end /* end seq = yes */
install_disk:
arg bt
/* check for a write protected disk */
""'info 'vol' | execio from 4 for 1 var diskinfo' /* get info on disk */
if compare(word(diskinfo,7),'Read') == 0 then do
say 'Disk is write protected !!'
exit
end
/* DE_INSTALL DISK */
if bt == NOBOOT = 1 then do forever
""'install 'vol 'noboot'
""'install 'vol 'check | execio for 1 var boot_ck' /* re-check the disk */
if compare(boot_ck,no_boot) == 0 then do
say "NOW UN-BOOTABLE"
return
end
else do
call yes_no "CAN'T UN-INSTALL THIS DISK !!..Retry ?"
if result = NO then return
end
end
if bt == SAVE then do /* save non-std */
call gdname vol /* calls our other function to get the disk name */
diskname = '"' || getclip('DNAME') || '"'
/* here we use another PD program to save the bootblock before we
install a correct BOOTBLOCK */
say 'saving bootblock to dh1:new/'diskname /*tell em what U R doing */
""'bootback 'vol' dh1:new/'diskname
""'filenote dh1:new/'diskname 'bootblock'
end
/* INSTALL GOOD BOOT BLOCK */
do forever /* use CBM DOC install cmd */
""'install 'vol /* install disk */
""'install 'vol 'check | execio for 1 var boot_ck' /* re check block */
if compare(boot_ck,real_boot) == 0 then do
say "Boot Block is now Correct "
return
end
else do /* could not correct bad boot block */
call yes_no "Error Installing this disk.. RETRY ?"
if result = NO then return
end
end